//
//  RKNavigationCtrl.swift
//  RKTemplate
//
//  Created by zhaoke on 2023/7/23.
//

import Foundation
import UIKit

class RKNavigationCtrl: UINavigationController {
    override func viewDidLoad() {
        super.viewDidLoad()
        self.setupNavigation()
    }
}
extension RKNavigationCtrl {
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        if viewControllers.count > 0 {
            viewController.hidesBottomBarWhenPushed = true
        }
        super.pushViewController(viewController, animated: animated)
    }
}
extension UINavigationController {
    func setupNavigation() {
        UINavigationBar.appearance().backgroundColor = .white
//        UINavigationBar.appearance().isTranslucent = false
        let appearance = navigationBar.standardAppearance
        appearance.backgroundImage = UIImage(rk_color: .white)
        appearance.shadowImage = UIImage()
        navigationBar.standardAppearance = appearance
        navigationBar.scrollEdgeAppearance = appearance
    }
}
